function jsonIOError(msg) {
	console.log("jsonIOError tab 5 :: msg:: ", msg);
}

/*Custom Dropdown function*/
$(function() {
	$(".ci-dropdown").each(function() {
		$(this).click(function(e) {
			e.stopPropagation(e);
			$(this).toggleClass('active');
			$(this).find('ul').slideToggle(100);
		});
		$(this).mouseleave(function(e) {
			$(this).find('ul').slideUp(100);
			$(this).removeClass('active');
		});

		$(this).find('ul li a').click(function(e) {

			var current = $(this).text();

			$(this).parents(".ci-dropdown").find('p').text(current);
			$(this).parent('ul').toggle();
			$(this).removeClass('active');
		});
	});
});

/*UI Jquery function*/
$(function() {

	$("#accordion").accordion({
		heightStyle : "content",
		autoHeight : false,
		collapsible : true
	});
	$("#accordion1").accordion({
		heightStyle : "content",
		autoHeight : false,
		collapsible : true
	});
	$(".accordion2").accordion({
		autoHeight : false,
		collapsible : true
	});
	$(".accordion3").accordion({
		autoHeight : false,
		collapsible : true
	});
	$("#accordion4").accordion({
		autoHeight : false,
		collapsible : true
	});

	$('.floorContentadded ul li:last-child').addClass('last');

	$('.floorSection ul li:last-child').addClass('last');
	$('ul.subList li:last-child').addClass('last');

	$('div.archivedData div.archivedBox:first-child').addClass('first');
	$('div.archivedData div.archivedBox:last-child').addClass('last');

	$('.schoolEventstable tr').each(function() {
		$(this).hover(function() {
			$(this).children('td').addClass('hover');
		});
		$(this).mouseleave(function(e) {
			$('.schoolEventstable tr td').removeClass('hover');
		});
	});

	$('.activeAcYear .schoolEventstable tr, .inActiveAcYear .schoolEventstable tr, .mark tr, .myClass .schoolEventstable tr').each(function() {
		$(this).hover(function() {
			$(this).children('td').removeClass('hover');
		});
	});

	$('.spin-left-arrow').click(function() {
		$(this).parents(".spinner").find('.up').show();
		$(this).parents(".spinner").find('.down').hide();
	});
	$('.spin-right-arrow').click(function() {
		$(this).parents(".spinner").find('.down').show();
		$(this).parents(".spinner").find('.up').hide();
	});

	$("#AYPmainTAB").tabs();
	$("#tabAYP1").tabs();

	$('input.valIn').each(function(i, input) {
		$('.progressbar').eq(i).progressbar({
			value : Number($(input).val())
		});
	});

	$(document).tooltip();
	$(".selector").tooltip({
		content : "Awesome title!"
	});

	$(".datepicker").datepicker({
		changeMonth : true,
		changeYear : true
	});
	$(".datepickerIcon").datepicker({
		changeMonth : true,
		changeYear : true,
		showOn : "button",
		buttonImage : "images/calendar.png",
		buttonImageOnly : true,
		altField : ".datepickerIcon",
		altFormat : "DD, d MM, yy"
	});
	
	var settings = {
		autoReinitialise : true
	};
	var pane = $('.scroll-pane')
	pane.jScrollPane(settings);

	var pane = $('.scroll-paneH')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane1')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane2')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane4')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane5')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane6')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane7')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane8')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane9')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane10')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane11')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane12')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane13')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane14')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane15')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane16')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane17')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane18')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane19')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane20')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane21')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane22')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane23')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane24')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane25')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane26')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane27')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane28')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane29')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane30')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane31')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane32')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane33')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane34')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane35')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane36')
	pane.jScrollPane(settings);

	var pane = $('.scroll-pane37')
	pane.jScrollPane(settings);

	var pane = $('.sBWrapper, .SBWrapper')
	pane.jScrollPane(settings);

});

/* Expand All for Accordian */
$(function() {
	$('#expandAccord').click(function(event) {
		$('#accordion h3').next().slideDown('normal');
		{
			$('#accordion h3').addClass('active');
		}
	});
});

/* Sho Add Device tables */
$(function() {
	$('#AddDevicesOkay').click(function(event) {
		$('#devicesMain').show();
		{
			$('#addDevicesBottomBtns').show();
		}
	});
});

/* Function to show Select Periods Checkboxes */
$(function() {
	$('.period').bind("change", function() {
		if ($(this).val() == "3") {
			$('#selectPeriodsCheckboxes').show();
		} else if ($(this).val() == "1", "2") {
			$('#selectPeriodsCheckboxes').hide();
		}
	});

	$('.optionAlternate').each(function() {
		var td = $(this).parent('td');
		var spin = td.next('td').children('span.wrap')

		$(this).bind("change", function() {
			if ($(this).val() == "2") {
				spin.show();
			} else if ($(this).val() == "1") {
				spin.hide();
			}

		});

	});

});

/* Function to show Question Paper Section */
$(function() {
	$('#createPaperTempOk').click(function(event) {
		$('#defineQuesPaperMain').show();
	});
});

/* Function to hide Alternate Section option */
$(function() {
	$('#mandSectionOpt1').click(function(event) {
		$('#altSection1').hide();
		{
			$('#altSection1TR TD').css("background-color", "#FFF");
		}
	});

	$('#mandSectionOpt2').click(function(event) {
		$('#altSection2').hide();
		{
			$('#altSection2TR TD').css("background-color", "#FFF");
		}
	});

	$('#mandSectionOpt3').click(function(event) {
		$('#altSection3').hide();
		{
			$('#altSection3TR TD').css("background-color", "#FFF");
		}
	});

	$('#mandSectionOpt4').click(function(event) {
		$('#altSection4').hide();
		{
			$('#altSection4TR TD').css("background-color", "#FFF");
		}
	});
});

/* JqueryUI Dialog function*/

$(function() {
	$("#dialog-student").dialog({
		autoOpen : false,
		width : 898,
		modal : true
	});
	$(".add-student").click(function() {
		$("#dialog-student").dialog("open");
		$("#dialog-student").dialog("option", "position", "center");
	});
	$("#saveInfo").click(function() {
		$("#dialog-student").dialog("close");
	});
	$("#cencelBox").click(function() {
		$("#dialog-student").dialog("close");
	});

	$("#dialog-studentInfo").dialog({
		autoOpen : false,
		width : 770,
		modal : true
	});
	$(".studentInfo").click(function() {
		$("#dialog-studentInfo").dialog("open");
		$("#dialog-studentInfo").dialog("option", "position", "center");
	});
	$("#dialog-studentInfo #saveInfo").click(function() {
		$("#dialog-studentInfo").dialog("close");
	});
	$("#dialog-studentInfo #cencelBox").click(function() {
		$("#dialog-studentInfo").dialog("close");
	});

	$("#dialog-schollInfo").dialog({
		autoOpen : false,
		width : 450,
		modal : true
	});
	$(".schollInfo").click(function() {
		$("#dialog-schollInfo").dialog("open");
		$("#dialog-schollInfo").dialog("option", "position", "center");
	});
	$("#dialog-schollInfo #saveInfo").click(function() {
		$("#dialog-schollInfo").dialog("close");
	});
	$("#dialog-schollInfo #cencelBox").click(function() {
		$("#dialog-schollInfo").dialog("close");
	});

	$("#chapters").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});
	$(".chapter").click(function() {
		$("#chapters").dialog("open");
		$("#chapters").dialog("option", "position", "center");
	});
	$("#chapters #okay").click(function() {
		$("#chapters").dialog("close");
	});
	$("#chapters #cencel").click(function() {
		$("#chapters").dialog("close");
	});

	$("#insert-Chapter").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});
	$(".insertChapter").click(function() {
		$("#insert-Chapter").dialog("open");
		$("#insert-Chapter").dialog("option", "position", "center");
	});
	$("#insert-Chapter #okay").click(function() {
		$("#insert-Chapter").dialog("close");
	});
	$("#insert-Chapter #cencel").click(function() {
		$("#insert-Chapter").dialog("close");
	});

	/*
	 $( "#dialog-define" ).dialog({
	 autoOpen: false,
	 width: 898,
	 modal: true
	 });
	 $(".subjects").click(function() {
	 $( "#dialog-define" ).dialog( "open" );
	 });
	 $("#dialog-define #saveInfo").click(function() {
	 $( "#dialog-define" ).dialog( "close" );
	 });
	 $("#dialog-define #cencelBox").click(function() {
	 $( "#dialog-define" ).dialog( "close" );
	 });
	 */
	$("#create-Section").dialog({
		autoOpen : false,
		width : 898,
		modal : true
	});
	$(".createSection").click(function() {
		$("#create-Section").dialog("open");
		$("#create-Section").dialog("option", "position", "center");
	});
	$("#saveInfo").click(function() {
		$("#create-Section").dialog("close");
	});
	$("#cencelBox").click(function() {
		$("#create-Section").dialog("close");
	});

	$("#sub-CoScholastic").dialog({
		autoOpen : false,
		width : 898,
		modal : true
	});
	$(".subCoScholastic").click(function() {
		$("#sub-CoScholastic").dialog("open");
		$("#sub-CoScholastic").dialog("option", "position", "center");
	});
	$("#saveInfo").click(function() {
		$("#sub-CoScholastic").dialog("close");
	});
	$("#cencelBox").click(function() {
		$("#sub-CoScholastic").dialog("close");
	});

	$("#add-Term").dialog({
		autoOpen : false,
		width : 898,
		modal : true
	});
	$(".addTerm").click(function() {
		var addTermDialog = $("#add-Term").dialog("open");
		addTermDialog.dialog("option", "position", "center");
	});
	$("#add-Term #saveInfo").click(function() {
		$("#add-Term").dialog("close");
	});
	$("#add-Term #cencelBox").click(function() {
		$("#add-Term").dialog("close");
	});

	$("#dialog-summative").dialog({
		autoOpen : false,
		width : 898,
		modal : true
	});
	$(".summative").click(function() {
		$("#dialog-summative").dialog("open");
		$("#dialog-summative").dialog("option", "position", "center");
	});
	$("#dialog-summative #save").click(function() {
		$("#dialog-summative").dialog("close");
	});
	$("#dialog-summative #cencel").click(function() {
		$("#dialog-summative").dialog("close");
	});

	$("#dialog-divice").dialog({
		autoOpen : false,
		width : 898,
		modal : true
	});
	$(".divice").click(function() {
		$("#dialog-divice").dialog("open");
		$("#dialog-divice").dialog("option", "position", "center");
	});
	$("#dialog-divice #save").click(function() {
		$("#dialog-divice").dialog("close");
	});
	$("#dialog-divice #cencel").click(function() {
		$("#dialog-divice").dialog("close");
	});

	$("#dialog-grid").dialog({
		autoOpen : false,
		width : 898,
		modal : true
	});
	$(".grid").click(function() {
		$("#dialog-grid").dialog("open");
		$("#dialog-grid").dialog("option", "position", "center");
	});
	$("#dialog-grid #save").click(function() {
		$("#dialog-grid").dialog("close");
	});
	$("#dialog-grid #cencel").click(function() {
		$("#dialog-grid").dialog("close");
	});

	$("#add-Event").dialog({
		autoOpen : false,
		width : 420,
		modal : true
	});
	$(".addEvent").click(function() {
		$("#add-Event").dialog("open");
		$("#add-Event").dialog("option", "position", "center");
	});
	$("#saveInfo1").click(function() {
		$("#add-Event").dialog("close");
	});
	$("#cencelBox1").click(function() {
		$("#add-Event").dialog("close");
	});

	$("#dialog-Archive").dialog({
		autoOpen : false,
		width : 420,
		modal : true
	});
	$(".archive").click(function() {
		$("#dialog-Archive").dialog("open");
		$("#dialog-Archive").dialog("option", "position", "center");
	});
	$("#dialog-Archive #confirm").click(function() {
		$("#dialog-Archive").dialog("close");
	});
	$("#dialog-Archive #cancle").click(function() {
		$("#dialog-Archive").dialog("close");
	});

	$("#dialog-Analysis").dialog({
		autoOpen : false,
		width : 420,
		modal : true
	});
	$(".analysis").click(function() {
		$("#dialog-Analysis").dialog("open");
		$("#dialog-Analysis").dialog("option", "position", "center");
	});
	$("#dialog-Analysis #save").click(function() {
		$("#dialog-Analysis").dialog("close");
	});
	$("#dialog-Analysis #cancel").click(function() {
		$("#dialog-Analysis").dialog("close");
	});

	$("#sub-CoScholastic").dialog({
		autoOpen : false,
		width : 898,
		modal : true
	});
	$(".subCoScholastic").click(function() {
		$("#sub-CoScholastic").dialog("open");
		$("#sub-CoScholastic").dialog("option", "position", "center");
	});
	$("#saveInfo").click(function() {
		$("#sub-CoScholastic").dialog("close");
	});
	$("#cencelBox").click(function() {
		$("#sub-CoScholastic").dialog("close");
	});

	/*	$( "#add-Schedule" ).dialog({
	 autoOpen: false,
	 width: 350,
	 modal: true
	 });*/
	$(".addSchedule").click(function() {
		$("#add-Schedule").dialog("open");
		$("#add-Schedule").dialog("option", "position", "center");

	});
	/*	$( "#saveInfo2" ).click(function() {
	 $( "#add-Schedule" ).dialog( "close" );
	 });
	 $( "#cencelBox2" ).click(function() {
	 $( "#add-Schedule" ).dialog( "close" );
	 });
	 */
	$("#automated-timetable").dialog({
		autoOpen : false,
		width : 327,
		modal : true
	});
	$(".automated").click(function() {
		$("#automated-timetable").dialog("open");
		$("#automated-timetable").dialog("option", "position", "center");
	});
	$("#automated-timetable #ok").click(function() {
		$("#automated-timetable").dialog("close");
	});
	$("#automated-timetable #cencel").click(function() {
		$("#automated-timetable").dialog("close");
	});

	$("#create-TimeTable").dialog({
		autoOpen : false,
		width : 327,
		modal : true
	});
	$(".createTimeTable").click(function() {
		$("#create-TimeTable").dialog("open");
		$("#create-TimeTable").dialog("option", "position", "center");
	});
	$("#create-TimeTable #ok").click(function() {
		$("#create-TimeTable").dialog("close");
	});
	$("#create-TimeTable #cencel").click(function() {
		$("#create-TimeTable").dialog("close");
	});

	$("#view-Teachers").dialog({
		autoOpen : false,
		width : 327,
		modal : true
	});
	$(".viewTeachers").click(function() {
		$("#view-Teachers").dialog("open");
		$("#view-Teachers").dialog("option", "position", "center");
	});
	$("#view-Teachers #saveInfo").click(function() {
		$("#view-Teachers").dialog("close");
	});
	$("#view-Teachers #cencelBox").click(function() {
		$("#view-Teachers").dialog("close");
	});

	$("#dialog-publish").dialog({
		autoOpen : false,
		width : 327,
		modal : true
	});
	$(".publish").click(function() {
		$("#dialog-publish").dialog("open");
		$("#dialog-publish").dialog("option", "position", "center");
	});
	$("#dialog-publish #confirm").click(function() {
		$("#dialog-publish").dialog("close");
	});
	$("#dialog-publish #cencel").click(function() {
		$("#dialog-publish").dialog("close");
	});

	$("#dialog-publish").dialog({
		autoOpen : false,
		width : 327,
		modal : true
	});
	$(".publish").click(function() {
		$("#dialog-publish").dialog("open");
		$("#dialog-publish").dialog("option", "position", "center");
	});
	$("#dialog-publish #confirm").click(function() {
		$("#dialog-publish").dialog("close");
	});
	$("#dialog-publish #cencel").click(function() {
		$("#dialog-publish").dialog("close");
	});

	$("#dialog-Generate").dialog({
		autoOpen : false,
		width : 327,
		modal : true
	});
	$(".generate").click(function() {
		$("#dialog-Generate").dialog("open");
		$("#dialog-Generate").dialog("option", "position", "center");
	});
	$("#dialog-Generate #confirm").click(function() {
		$("#dialog-Generate").dialog("close");
	});
	$("#dialog-Generate #cencel").click(function() {
		$("#dialog-Generate").dialog("close");
	});

	// $( "#assign-Subject" ).dialog({
	// autoOpen: false,
	// width: 420,
	// modal: true
	// });
	// $( ".assign" ).click(function() {
	// $( "#assign-Subject" ).dialog( "open" );
	// });
	// $( "#assign-Subject #save" ).click(function() {
	// $( "#assign-Subject" ).dialog( "close" );
	// });
	// $( "#assign-Subject #cencel" ).click(function() {
	// $( "#assign-Subject" ).dialog( "close" );
	// });

	// $( "#create-Shift" ).dialog({
	// autoOpen: false,
	// width: 520,
	// modal: true
	// });
	// $( ".createShift" ).click(function() {
	// $( "#create-Shift" ).dialog( "open" );
	// });
	// $( "#create-Shift #save" ).click(function() {
	// $( "#create-Shift" ).dialog( "close" );
	// });
	// $( "#create-Shift #cencel" ).click(function() {
	// $( "#create-Shift" ).dialog( "close" );
	// });

	$("#dialog-clone").dialog({
		autoOpen : false,
		width : 420,
		modal : true
	});
	$(".clone").click(function() {
		$("#dialog-clone").dialog("open");
		$("#dialog-clone").dialog("option", "position", "center");
	});
	$("#dialog-clone #clone").click(function() {
		$("#dialog-clone").dialog("close");
	});
	$("#dialog-clone #cencel").click(function() {
		$("#dialog-clone").dialog("close");
	});

	/* function to show Assign Roll Numbers Dialog box */
	$("#assign-roll").dialog({
		autoOpen : false,
		width : 400,
		modal : true
	});
	$(".assignRoll").click(function() {
		$("#assign-roll").dialog("open");
		$("#assign-roll").dialog("option", "position", "center");
	});
	$("#assign-roll #saveInfo").click(function() {
		$("#assign-roll").dialog("close");
	});
	$("#assign-roll #cencelBox").click(function() {
		$("#assign-roll").dialog("close");
	});

	//Add Marks dialog box
	$("#add-marks").dialog({
		autoOpen : false,
		width : 400,
		modal : true
	});
	$(".addMarks").click(function() {
		$("#add-marks").dialog("open");
		$("#add-marks").dialog("option", "position", "center");
	});
	$("#add-marks #proceed").click(function() {
		$("#add-marks").dialog("close");
	});
	$("#add-marks #cencelBox").click(function() {
		$("#add-marks").dialog("close");
	});

	//Course Completion dialog box
	$("#course-completion").dialog({
		autoOpen : false,
		width : 898,
		modal : true
	});
	$(".courseCompletion").click(function() {
		$("#course-completion").dialog("open");
		$("#course-completion").dialog("option", "position", "center");
	});
	$("#course-completion #okay").click(function() {
		$("#course-completion").dialog("close");
	});
	$("#course-completion #cencelBox").click(function() {
		$("#course-completion").dialog("close");
	});

	//Class Performance dialog box
	$("#class-performance").dialog({
		autoOpen : false,
		width : 898,
		modal : true
	});
	$(".classPerformance").click(function() {
		$("#class-performance").dialog("open");
		$("#class-performance").dialog("option", "position", "center");
	});
	$("#class-performance #okay").click(function() {
		$("#class-performance").dialog("close");
	});
	$("#class-performance #cencelBox").click(function() {
		$("#class-performance").dialog("close");
	});

	/* Get Chapter List popup */
	$("#get-chapterList").dialog({
		autoOpen : false,
		width : 400,
		modal : true
	});
	$(".getChapterList").click(function() {
		$("#get-chapterList").dialog("open");
		$("#get-chapterList").dialog("option", "position", "center");
	});
	$("#okay1").click(function() {
		if ($('#retrieveRdo').is(':checked')) {
			$("#retrieve-chapterList").dialog("open");
			$("#retrieve-chapterList").dialog("option", "position", "center");
		}
		if ($('#createRdo').is(':checked')) {
			$("#create-chapterList").dialog("open");
			$("#create-chapterList").dialog("option", "position", "center");
		}
		$("#get-chapterList").dialog("close");
	});
	$("#get-chapterList #cencelBox").click(function() {
		$("#get-chapterList").dialog("close");
	});

	// Retrieve Chapter List from testEdge popup
	$("#retrieve-chapterList").dialog({
		autoOpen : false,
		width : 600,
		modal : true
	});
	$("#okay2").click(function() {
		$("#retrieve-chapterList").dialog("close");

	});
	$("#retrieve-chapterList #cencelBox").click(function() {
		$("#retrieve-chapterList").dialog("close");
	});

	// Retrieve Chapter List from testEdge popup
	$("#create-chapterList").dialog({
		autoOpen : false,
		width : 350,
		modal : true
	});
	$("#okay3").click(function() {
		$("#create-chapterList").dialog("close");

	});
	$("#create-chapterList #cencelBox").click(function() {
		$("#create-chapterList").dialog("close");
	});

	/* Confirm Save Plan popup */
	$("#confirm-savePlan").dialog({
		autoOpen : false,
		width : 400,
		modal : true
	});
	$(".confirmSavePlan").click(function() {
		$("#confirm-savePlan").dialog("open");
		$("#confirm-savePlan").dialog("option", "position", "center");
	});
	$("#confirm-savePlan #confirm").click(function() {
		$("#confirm-savePlan").dialog("close");
	});
	$("#confirm-savePlan #cencelBox").click(function() {
		$("#confirm-savePlan").dialog("close");
	});

	/* Repeat Year popup */
	$("#repeat-year").dialog({
		autoOpen : false,
		width : 400,
		modal : true
	});
	$(".repeatYear").click(function() {
		$("#repeat-year").dialog("open");
		$("#repeat-year").dialog("option", "position", "center");
	});
	$("#repeat-year #repeatYearSave").click(function() {
		$("#repeat-year").dialog("close");
	});
	$("#repeat-year #cencelBox").click(function() {
		$("#repeat-year").dialog("close");
	});

	/* Inactive Year popup */
	$("#inactive-year").dialog({
		autoOpen : false,
		width : 420,
		modal : true
	});
	$(".inactiveYear").click(function() {
		$("#inactive-year").dialog("open");
		$("#inactive-year").dialog("option", "position", "center");
	});
	$("#inactive-year #inactiveOkay").click(function() {
		$("#inactive-year").dialog("close");
	});
	$("#inactive-year #cencelBox").click(function() {
		$("#inactive-year").dialog("close");
	});

	/* Add Devices popup */
	$("#add-devices").dialog({
		autoOpen : false,
		width : 898,
		modal : true
	});
	$(".addDevices").click(function() {
		$("#add-devices").dialog("open");
		$("#add-devices").dialog("option", "position", "center");
	});
	$("#add-devices #AddDevicesSave").click(function() {
		$("#add-devices").dialog("close");
	});
	$("#add-devices #cencelBox").click(function() {
		$("#add-devices").dialog("close");
	});

	/* Create New Paper Template Popup */
	$("#create-paperTemplate").dialog({
		autoOpen : false,
		width : 898,
		modal : true
	});
	$(".createPaperTemplate").click(function() {
		$("#create-paperTemplate").dialog("open");
		$("#create-paperTemplate").dialog("option", "position", "center");
	});
	$("#create-paperTemplate #createPaperTempSave").click(function() {
		$("#create-paperTemplate").dialog("close");
	});
	$("#create-paperTemplate #cencelBox").click(function() {
		$("#create-paperTemplate").dialog("close");
	});
	/*
	 $( "#dialog-confirm2" ).dialog({
	 autoOpen: false,
	 width: 420,
	 modal: true
	 });
	 $( "#radio1" ).click(function() {
	 $( "#dialog-confirm2" ).dialog( "open" );
	 });
	 $( "#dialog-confirm2 #delete" ).click(function() {
	 $( "#dialog-confirm2" ).dialog( "close" );
	 });
	 $( "#dialog-confirm2 #cencel" ).click(function() {
	 $( "#dialog-confirm2" ).dialog( "close" );
	 });

	 $( "#dialog-confirm3" ).dialog({
	 autoOpen: false,
	 width: 420,
	 modal: true
	 });
	 $( "#radio2" ).click(function() {
	 $( "#dialog-confirm3" ).dialog( "open" );
	 });
	 $( "#dialog-confirm3 #delete" ).click(function() {
	 $( "#dialog-confirm3" ).dialog( "close" );
	 });
	 $( "#dialog-confirm3 #cencel" ).click(function() {
	 $( "#dialog-confirm3" ).dialog( "close" );
	 });

	 $( "#dialog-confirm4" ).dialog({
	 autoOpen: false,
	 width: 420,
	 modal: true
	 });
	 $( "#radio3" ).click(function() {
	 $( "#dialog-confirm4" ).dialog( "open" );
	 });
	 $( "#dialog-confirm4 #delete" ).click(function() {
	 $( "#dialog-confirm4" ).dialog( "close" );
	 });
	 $( "#dialog-confirm4 #cencel" ).click(function() {
	 $( "#dialog-confirm4" ).dialog( "close" );
	 });

	 */
	$("#dialog-confirm5").dialog({
		autoOpen : false,
		width : 200,
		modal : true
	});
	$(".selectGp").click(function() {
		$("#dialog-confirm5").dialog("open");
		$("#dialog-confirm5").dialog("option", "position", "center");
	});
	$("#dialog-confirm5 #done").click(function() {
		$("#dialog-confirm5").dialog("close");
	});
	$("#dialog-confirm5 #cencel").click(function() {
		$("#dialog-confirm5").dialog("close");
	});

	/*Active Inactive block function*/

	/*$('.activeTab a').click(function(){
	 var $this = $(this);
	 $this.parent().find('a').removeClass('active');
	 $this.parent().find('a').addClass('inActive');
	 $this.addClass('active');
	 $this.removeClass('inActive');

	 });*/

	/*Delete block function*/

	/*$( "#dialog-confirm" ).dialog({
	 autoOpen: false,
	 width: 420,
	 modal: true
	 });
	 $(".deleteIconTitle, .deleteRow").each(function() {
	 $(this).click(function(event) {
	 $( "#dialog-confirm" ).dialog( "open" );
	 });
	 });
	 $("#dialog-confirm #delete").click(function(){
	 $( "#dialog-confirm" ).dialog( "close" );
	 $("h3.ui-accordion-header.ui-state-focus").next('div').remove();
	 $("h3.ui-accordion-header.ui-state-focus").remove();
	 });
	 $("#dialog-confirm #cencel").click(function(){
	 $( "#dialog-confirm" ).dialog( "close" );
	 });
	 */
	$("#dialog-confirm1").dialog({
		autoOpen : false,
		width : 420,
		modal : true
	});

	$(".deleteIcon, .crossIcon").each(function() {
		$(this).click(function() {
			$("#dialog-confirm1").dialog("open");
			$("#dialog-confirm1").dialog("option", "position", "center");
			$(this).addClass('remove');
		});
	});
	$("#dialog-confirm1 #delete").click(function() {
		$("#dialog-confirm1").dialog("close");
		var divparent = $('.remove').closest('div, tr, li');
		divparent.remove();
	});
	$("#dialog-confirm1 #cencel").click(function() {
		$("#dialog-confirm1").dialog("close");
	});

	/*Select Class Room function*/

	$('a.seletc').hover(function() {
		console.log("on hover ...................");
		var div = $(this).siblings('div.showBox, ul.selectClass');
		div.addClass('up');
		div.show();
		$(this).mouseout(function() {
			div.removeClass('up');
			div.hide();
		});
		div.mouseenter(function() {
			div.addClass('up');
			div.show();
		});
		div.mouseleave(function() {
			div.removeClass('up');
			div.hide();
		});
		$('.done').click(function() {
			div.hide();
		});

		var room = $('.showBox a.room');

		room.click(function() {
			$('.showBox a.room').removeClass('add');
			$(this).addClass('add');
		});
		room.dblclick(function() {
			$(this).removeClass('add');
		});

	});

});

$(function() {
	var availableTags = ["Ms. David", "Ms. Dave", "Ms. Daisy", "Mr. Darshan Pandya"];
	$(".sugges").autocomplete({
		source : availableTags
	});

	var spinner = $(".timeSpinner").spinner();

	$("#shifts").buttonset();

	$(".roomWrap").buttonset();

	$('#sliderRange .circle').click(function() {
		var arow = $(this).children('div.arrow');
		$('#sliderRange .arrow').removeClass('active');
		arow.addClass('active');
	});

	$('.promote tr').each(function() {
		$(this).hover(function() {
			var btns = $(this).children('td.addButton');
			btns.children('a.button').css({
				'visibility' : 'visible'
			});
		});
		$(this).mouseleave(function() {
			var btns = $(this).children('td.addButton');
			btns.children('a.button').css({
				'visibility' : 'hidden'
			});
		});
	});

});

$.widget("ui.timespinner", $.ui.spinner, {
	options : {
		// seconds
		step : 60 * 1000,
		// hours
		page : 60
	},

	_parse : function(value) {
		if ( typeof value === "string") {
			// already a timestamp
			if (Number(value) == value) {
				return Number(value);
			}
			return +Globalize.parseDate(value);
		}
		return value;
	},

	_format : function(value) {
		return Globalize.format(new Date(value), "t");
	}
});

$(function() {
	Globalize.culture("de-DE");
	//  $( ".spinnerT" ).timespinner();
});
